package service

import (
	"context"
	"cronjob_work/internal/model/entity"
	"github.com/gogf/gf/v2/frame/g"
)

type ITask interface {
	TaskGetList(ctx context.Context, page, pageSize int, filters ...interface{}) ([]*entity.PpTask, int64)
	TaskGetById(ctx context.Context, id int) (*entity.PpTask, error)
	Update(ctx context.Context, condition g.Map, data g.Map) error
}

var localTask ITask

func Task() ITask {
	if localTask == nil {
		panic("implement not found for interface ITask, forgot register?")
	}

	return localTask
}

func RegisterTask(i ITask) {
	localTask = i
}
